package com.dfbz.demo;

import java.util.Enumeration;
import java.util.ListIterator;
import java.util.Vector;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo06_Vector {
    public static void main(String[] args) {
        Vector<String> vector=new Vector<>();
        vector.add("a");
        vector.add("b");
        vector.add("c");

        System.out.println(vector);

        ListIterator<String> listIterator = vector.listIterator();

        while (listIterator.hasNext()){
            String ele = listIterator.next();

            if("b".equals(ele)){
                listIterator.add("hahaha");
            }
        }
        System.out.println("------------");

        System.out.println(vector);

       /* Enumeration<String> elements = vector.elements();
        while (elements.hasMoreElements()){
            String ele = elements.nextElement();
            if("b".equals(ele)){
                vector.add("hahah");
            }
        }

        System.out.println(vector);*/


    }
}
